import axios from 'axios';

// axios基本设置
const instance = axios.create({
    baseURL: '',
    headers: {
        'Content-type': 'application/json'
    }
});

export default {
    post(api: string, params?: any, options?: any) {
        return new Promise((resolve, reject) => {
            axios.post(api, params, options).then((response) => {
                resolve(response);
            }).catch((err) => {
                reject(err);
            });
        });
    },
    get(api: string, params?: any) {
        return new Promise((resolve, reject) => {
            axios.get(api, {
                params
            }).then((response: any) => {
                resolve(response);
            }).catch((err: any) => {
                reject(err);
            });
        });
    }
}